﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;

namespace EmailHandler
{
    public class EmailSender
    {
        public static void Send()
        {
            try
            {
                SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
                var mail = new MailMessage();
                mail.From = new MailAddress("kartc@live.com");
                mail.To.Add("v-kartc@microsoft.com");
                mail.Subject = "Html Test Mail ";
                mail.IsBodyHtml = true;
                string htmlBody = "<html><h1>hmmm...</h1><table><tr><td>First Name</td><td>Middle Name</td><td>Last Name</td></tr><tr><td>Karthik</td><td>Nahi hai re</td><td>C</td></tr><tr><td>what?</td><td>???</td><td>what yaar</td></tr></table></html>";
                //htmlBody = htmlBody;
                mail.Body = htmlBody;
                SmtpServer.Port = 587;
                SmtpServer.UseDefaultCredentials = false;
                SmtpServer.Credentials = new System.Net.NetworkCredential("kartc@live.com", "Rkrishna123$");
                SmtpServer.EnableSsl = true;
                SmtpServer.Send(mail);
            }
            catch (Exception ex)
            {

            }

        }
    }
}
